package Classes.GameViews.ViewPanels
{
	import Classes.GameViews.ViewScenes.VS_Main;
	import Classes.Managers.M_ConfigData;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.ApplicationDomain;

	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Jul 18, 2012 6:52:11 PM 
	 */ 
	public class VP_NewWeaponWin extends ViewPanel
	{
		private var _interfaceUI:Sprite;
		private var dobj:DisplayObject;
		
		public function VP_NewWeaponWin()
		{
			
			this.init();
		}
		
		private function init():void
		{
			this._interfaceUI=new (ApplicationDomain.currentDomain.getDefinition("NewWeaponWindown_v") as Class);
			dobj=this.addChild(this._interfaceUI);
			this.addListener();
		}
		
		/**
		 * 给武器赋值 
		 * @param ic
		 * @param tips
		 * 
		 */		
		public function setWeaponIc(ic:DisplayObject,tips:String=""):void
		{
			ic.width=106;
			ic.height=106;
			this._interfaceUI["setWeaponIc"](ic,tips);
			this.openNewWeaponWin();
		}
		
		/**
		 * 打开得到新武器的面板
		 */		
		public function openNewWeaponWin():void
		{
			this.openAt(VS_Main.instance,true);
			this.toCenter();
		}
		
		private function addListener():void
		{
			this.addEventListener("close",closeHandler);
		}
		
		private function closeHandler(e:Event):void
		{
			this.removeEventListener("close",closeHandler);
			this.removeChild(this._interfaceUI);
			this._interfaceUI=null;
			this.dobj=null;
			this.close();
		}
		
	}
}
